import {clamp} from '../helper';
import {HslaColor, RgbaColor} from '../type';
import {rgbaToHsla} from '../color/model/hsl';

export const lighten = (rgba: RgbaColor, amount: number): HslaColor => {
    const hsla = rgbaToHsla(rgba);

    return {
        h: hsla.h,
        s: hsla.s,
        l: clamp(hsla.l + amount * 100, 0, 100),
        a: hsla.a
    };
};
